#define DEBUG
#include <cstdio>
#include <ctime>
#include <cstdlib>

using namespace std;

void makeData() {
  FILE *in=fopen("puzzle.in", "w");
  int n=6, m=6, s=rand()%6+1;
  fprintf(in, "1\n%d %d\n", s, n);
  for (int i=1; i<=s; i++) {
    int w=rand()%(m-(s-i))+1;
    m -= w;
    fprintf(in, "%d\n", w);
    for (int j=1; j<=n; j++) {
      for (int k=1; k<=w; k++) {
	fprintf(in, "%d", rand()%2);
      }
      fprintf(in, "\n");
    }
    fprintf(in, "\n");
  }
  fclose(in);
}

int main() {
  srand(time(NULL));

  for (;;)  {
    makeData();
    if (system("./src")) {
      printf("RE\n");
    } else if (system("./checker")) {
      printf("CE\n");
    } else if (system("cmp puzzle.out checker.out")) {
      printf("WA\n");
    }
  }
  return 0;
}
